<% content_for :header do %>
  <ul class="namespaces">
    <% puffer_scopes_navigation do |title, path, current| %>
      <li<%= raw(current ? ' class="selected"' : '') %>><%= link_to title.to_s.humanize, path %></li>
    <% end %>
  </ul>
  <ul class="navigation">
    <% puffer_groups_navigation do |title, path, current| %>
      <li<%= raw(current ? ' class="selected"' : '') %>><%= link_to title.to_s.humanize, path %></li>
    <% end %>
  </ul>
<% end %>

<% content_for :content do %>
  <div class="columns fixed_layout">
    <div class="column sidebar">
      <div class="padder">
        <ul class="navigation">
          <% puffer_resources_navigation do |title, path, current| %>
            <li<%= raw(current ? ' class="selected"' : '') %>>
              <%= link_to title, path %>
              <%= link_to '+', resource.new_path, :class => 'add_entity' if current && controller.configuration.create %>
              <% if current %>
                <div class="additional">
                  <dl>
                    <% if _collections.present? %>
                      <dt>Links</dt>
                      <dd>
                        <% _collections.each do |collection| %>
                          <%= link_to collection.label, resource.collection_path(:action => collection.action) if collection.display? && [:match, :get].include?(collection.method) %>
                        <% end %>
                      </dd>
                    <% end %>

                    <%= form_for puffer_filters, :url => resource.collection_path, :method => :get do |f| %>
                      <dt><%= f.label :puffer_search %></dt>
                      <dd><%= f.text_field :puffer_search %></dd>
                      <dt><%= f.label :puffer_per_page %></dt>
                      <dd><%= f.text_field :puffer_per_page %></dd>

                      <% filter_fields.columns.each do |field| %>
                        <%= field.render :filter, controller, puffer_filters %>
                      <% end %>

                      <dd><%= submit_tag 'Search', :name => nil %></dd>
                    <% end %>

                  </dl>
                </div>
              <% end %>
            </li>
          <% end %>
        </ul>
        <%= yield :sidebar %>
      </div>
    </div>
    <div class="column">
      <div class="content" id="content">
        <%= yield %>
      </div>
    </div>
  </div>
<% end %>

<%= render :file => 'layouts/puffer_base' %>
